package com.example.lesson.entity

class Lesson constructor( var date:String? , var content:String?, var  state:State?) {
//class Lesson constructor(var date:String? ,var content:String?, var state:State?) {

/*
   原代码，优化到主构建器中，简化代码
   var date:String?=null;
    var content:String?=null;
    var state:State?=null;
    constructor(date:String? ,content:String?, state:State?){
    this.date = date;
    this.content = content;
    this.state = state;
}*/
/*
var date:String?=null;//成员属性在初始时是可以访问到构造参数中参数变量的，那么可以把这里定义的成员变量在主构造器中定义节省重复的定义
    var content:String?=null;
    var state:State?=null;
init{
    this.date = date;
    this.content = content;
    this.state = state;
}*/

    enum class State{
        PLAYBACK {
            override   fun stateName() :String{
                return "有回放";
            }
        },
        LIVE {
            override    fun stateName() :String{
                return "正在直播";
            }
        },
        WAIT {
              override  fun stateName() :String{
                return "等待中";
            }
        };
          abstract fun  stateName():String;
    }

}